<template>
    <h1>keepAlive缓存组件</h1>

    <button @click="show = !show">切换</button>

    <!-- KeepAlive 默认情况下会将所有的组件都会缓存 -->
    <!-- <KeepAlive include="A"> -->
    <!-- <KeepAlive exclude="A"> -->
    <KeepAlive>
        <A v-if="show" />
        <B v-else />
    </KeepAlive>


</template>

<script setup>
    import {ref} from 'vue'

    import A from './A.vue'
    import B from './B.vue'

    let show = ref(true)
</script>